package cn.com.sinosoft.exam.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.com.sinosoft.exam.annotation.PageParamer;
import cn.com.sinosoft.exam.model.Follow;
import cn.com.sinosoft.exam.model.Patient;
import cn.com.sinosoft.exam.page.PageParam;
import cn.com.sinosoft.exam.service.PatientService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;

/**
 * 
 * 患者管理控制器
 * @author xl
 *
 */
@Slf4j
@RestController
@RequestMapping("/patient")
@Api(tags = "患者管理Api")
public class PatientController {
	
	@Autowired
	PatientService patientService;
	
	/**
	 * 临时生成Model属性说明使用
	 * 忽略该方法
	 * @param params
	 * @return
	 */
	@ApiOperation(value="查询患者列表", hidden=true)
	@GetMapping("/temp")
	ResponseEntity<?> temp(@RequestBody Patient patient, @RequestBody Follow follow) {
		return null;
	}

	/**
	 * 分页示例
	 * 查询患者列表
	 * @param params
	 * @return
	 */
	@ApiOperation("查询患者列表")
	@GetMapping("/page")
	ResponseEntity<?> pagePatient(@ApiParam("查询条件") @RequestParam Map<String, Object> params,
			@PageParamer PageParam pageParam) {
		log.info("查询患者列表：{}", params);
		return ResponseEntity.ok(patientService.page(params, pageParam));
	}

}
